package com.zuoye.day14;


import java.io.File;



public class FileDemo {

  public static void main(String[] args) {
      String path = "D:\\workspace";
      File f = new File(path);
      FileDemo.getFile(f);
  }

    public static void getFile(File file){
        if(file != null){   //第一层文件夹
            File[] f = file.listFiles();
            if(f != null){  //判断子文件
                for(int i=0;i<f.length;i++){
                    getFile(f[i]);
                }
            }else{
                System.out.println(file);
            }
        }
    }
}
 /*  public static void main(String[] args) {

            File srcFile = new File("D:\\workspace");
            File[] fileArray = srcFile.listFiles();
            for (int i = 0; i < fileArray.length; i++) {
                //  System.out.println(fileArray[i].getName());
                if (fileArray[i].isDirectory())
                    System.out.println(fileArray[i]);
                if (fileArray[i].isFile())
                    System.out.println(fileArray[i]);

            }


        }*/























